#include <iostream>
#include <vector>

using namespace std;

struct ListNode
{
	int val;
	struct ListNode *next;
	ListNode(int x):val(x),next(NULL){}
};

vector<int> printListFromTailToHead(ListNode* head) {
	vector<int> valVector;
	ListNode *p = head;
	while (p != NULL)
	{
		valVector.insert(valVector.begin(),p->val);
		p = p->next;
	}
	return valVector;
}

//int main()
//{
//	ListNode *head, *p;
//	head = p = new ListNode(1);
//	p->next = new ListNode(2);
//	p = p->next;
//	p->next = new ListNode(3);
//
//	printListFromTailToHead(head);
//	
//}